package com.example.demo.controller;

import com.example.demo.bean.User;
import com.example.demo.dao.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: ZZZ
 * @time: 2021/8/3 21:26
 */
@RestController
public class MybatisPlusController {
    @Autowired
    public UserMapper userMapper;
@RequestMapping("/getAll")
    public Object getAll(){
         //return userMapper.selectList(null);
    User user=new User();
    user.setAge(2);
    user.setName("fdsf");
    int n = userMapper.insert(user);
    System.out.println(n);
    User user1 = userMapper.selectById(user.getSno());
    System.out.println(user1.toString());

    return user.toString();
    }
}
